package com.shopping.dao;

import com.shopping.pojo.RetailRole;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

@Component
@Mapper
public interface RetailRoleDao {

    String TABLE_NAME = "retail_role";
    String INSERT_FIELDS = "id, store_id, id_number";
    String SELECT_FIELDS = "id, store_id storeId, id_number idNumber";

    @Insert({"insert into ", TABLE_NAME, "(", INSERT_FIELDS, ") values(#{storeId}, #{idNumber})"})
    int insert(RetailRole retailRole);

    @Select({"select store_id from ", TABLE_NAME, " where id=#{id}"})
    int selectStoreId(@Param("userId") int userId);

}
